<template>
  <div>
    <van-nav-bar
    :fixed=true
    left-arrow
     @click-left="onClickLeft"
    >
    </van-nav-bar>
    <div class="address">
      <h2>修改地址</h2>
     <van-address-edit
        :area-list="areaList"
        show-set-default
        @save="onSave"
      />
    </div>
  </div>
</template>

<script>
  export default{
    name:'Upadd',
    data(){
      return{
        value:'',
        areaList:{
           province_list: {
              110000: '北京市',
                  120000: '天津市',
                  130000: '河北省',
                  140000: '山西省',
                  150000: '内蒙古自治区',
                  210000: '辽宁省',
                  220000: '吉林省',
                  230000: '黑龙江省',
                  310000: '上海市',
                  320000: '江苏省',
                  330000: '浙江省',
                  340000: '安徽省',
                  350000: '福建省',
                  360000: '江西省',
                  370000: '山东省',
                  410000: '河南省',
                  420000: '湖北省',
                  430000: '湖南省',
                  440000: '广东省',
                  450000: '广西壮族自治区',
                  460000: '海南省',
                  500000: '重庆市',
                  510000: '四川省',
                  520000: '贵州省',
                  530000: '云南省',
                  540000: '西藏自治区',
                  610000: '陕西省',
                  620000: '甘肃省',
                  630000: '青海省',
                  640000: '宁夏回族自治区',
                  650000: '新疆维吾尔自治区',
                  710000: '台湾省',
                  810000: '香港特别行政区',
                  820000: '澳门特别行政区',
                  900000: '海外'
            },
            city_list: {
              110100: '北京市',
                  120100: '天津市',
                  130100: '石家庄市',
                  130200: '唐山市',
                  130300: '秦皇岛市',
                  130400: '邯郸市',
                  130500: '邢台市',
                  130600: '保定市',
                  130700: '张家口市',
                  130800: '承德市',
                  130900: '沧州市',
                  131000: '廊坊市',
                  131100: '衡水市',
                  140100: '太原市',
                  140200: '大同市',
                  140300: '阳泉市',
                  140400: '长治市',
                  140500: '晋城市',
                  140600: '朔州市',
                  140700: '晋中市',
                  140800: '运城市',
                  140900: '忻州市',
                  141000: '临汾市',
                  141100: '吕梁市',
                  150100: '呼和浩特市',
                  150200: '包头市',
                  150300: '乌海市',
                  150400: '赤峰市',
                  150500: '通辽市',
                  150600: '鄂尔多斯市',
                  150700: '呼伦贝尔市',
                  150800: '巴彦淖尔市',
                  150900: '乌兰察布市',
                  152200: '兴安盟',
                  152500: '锡林郭勒盟',
                  152900: '阿拉善盟',
                  210100: '沈阳市',
                  210200: '大连市',
                  210300: '鞍山市',
                  210400: '抚顺市',
                  210500: '本溪市',
                  210600: '丹东市',
            },
            county_list: {
               110101: '东城区',
                  110102: '西城区',
                  110105: '朝阳区',
                  110106: '丰台区',
                  110107: '石景山区',
                  110108: '海淀区',
                  110109: '门头沟区',
                  110111: '房山区',
                  110112: '通州区',
                  110113: '顺义区',
                  110114: '昌平区',
                  110115: '大兴区',
                  110116: '怀柔区',
                  110117: '平谷区',
                  110118: '密云区',
                  110119: '延庆区',
                  120101: '和平区',
                  120102: '河东区',
                  120103: '河西区',
                  120104: '南开区',
                  120105: '河北区',
                  120106: '红桥区',
                  120110: '东丽区',
                  120111: '西青区',
                  120112: '津南区',
                  120113: '北辰区',
                  120114: '武清区',
                  120115: '宝坻区',
                  120116: '滨海新区',
                  120117: '宁河区',
                  120118: '静海区',
                  120119: '蓟州区',
                  130102: '长安区',
                  130104: '桥西区',
            }
        },
        searchResult: [],
      }
    },
    methods:{
      onClickLeft(){
        this.$router.go(-1)
      },
      onSave(content) {
        localStorage.setItem('aname',content.name)
        localStorage.setItem('tel',content.tel)
        localStorage.setItem('province',content.province)
        localStorage.setItem('city',content.city)
        localStorage.setItem('county',content.county)
        localStorage.setItem('addressDetail',content.addressDetail)
        localStorage.setItem('isDefault',content.isDefault)
        this.$router.push('/address')
      },
    }
  }
</script>

<style scoped="">
  .van-icon-arrow-left{
    color: #bfbfbf;
    font-size: 24px;
  }
  .address{
    padding: 0 20px;
  }
  h2{
    text-align: left;
    font-size: 24px;
    margin-left: 10px;
    line-height: 60px;
  }
  .address >>> .van-button{
    position: absolute;
    bottom: 0;
    left: 0;
    padding: 0;
    margin: 0;
    background: #e8e8e8;
    border: 0;
    color: #000000;
    font-size: 20px;
    caret-color: #fcdc01;
    font-weight: 600;
  }
  .address >>> .van-switch{
    /* font-size: 12px; */
    width: 50px;
    height: 22px;
  }
  .address >>> .van-switch--on{
    background:#F5CA03;
  }
</style>
